﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using FazaDemo.Data;

namespace FazaDemo.BL.DataAccess
{
    public class EntityRepository<T, TId> : IRepository<T, TId> 
        where T : class
    {

        public T Get(TId id)
        {
            return default(T);
        }

        public IList<T> GetAll()
        {
            using (var context = new FazaEntities1())
            {
                return context.Set<T>().ToList();
            }
        }

        public T FindOne(Func<T, bool> predicate)
        {
            using (var context = new FazaEntities1())
            {
                return context.Set<T>().First(predicate);
            }
        }

    }
}
